Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@turf/along
Advanced tools
@turf/along is a module from the Turf.js library that allows you to calculate a point at a specified distance along a line. This can be useful for various geospatial analyses, such as finding a location a certain distance from a starting point on a path or route.
Calculate a point along a line
This feature allows you to calculate a point that is a specified distance along a given line. In this example, a point 5 kilometers along the line is calculated.
const turf = require('@turf/turf');
const line = turf.lineString([[0, 0], [10, 10], [20, 20]]);
const distance = 5;
const options = { units: 'kilometers' };
const point = turf.along(line, distance, options);
console.log(point);
Geolib is a library for geospatial calculations in JavaScript. It provides various functions for distance calculations, finding points within a certain radius, and more. Compared to @turf/along, geolib offers a broader range of geospatial utilities but may not be as specialized in line-based calculations.
Geodesy is a library for geodesic calculations in JavaScript. It includes functions for calculating distances, bearings, and points along a path. While it offers similar functionality to @turf/along, it is more focused on geodesic calculations and may be more suitable for applications requiring high precision over long distances.
Takes a line and returns a point at a specified distance along the line.
Parameters
line
Feature<LineString> input linedistance
number distance along the lineunits
[string] can be degrees, radians, miles, or kilometers (optional, default kilometers
)Examples
var line = {
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [
[-77.031669, 38.878605],
[-77.029609, 38.881946],
[-77.020339, 38.884084],
[-77.025661, 38.885821],
[-77.021884, 38.889563],
[-77.019824, 38.892368]
]
}
};
var along = turf.along(line, 1, 'miles');
//=along
Returns Feature<Point> Point distance
units
along the line
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Install this module individually:
$ npm install @turf/along
Or install the Turf module that includes it as a function:
$ npm install @turf/turf
FAQs
turf along module
The npm package @turf/along receives a total of 794,846 weekly downloads. As such, @turf/along popularity was classified as popular.
We found that @turf/along demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.